<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
		<!-- Google Chrome Frame也可以让IE用上Chrome的引擎: -->
		<meta name="renderer" content="webkit">
		<!--国产浏览器高速模式-->
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="网站简介" />
		<!-- 网站简介 -->
		<meta name="keywords" content="搜索关键字，以半角英文逗号隔开" />
		<title>车辆编辑</title>
		
		<!-- 公共样式 开始 -->
		<link rel="stylesheet" type="text/css" href="../../css/base.css">
		<link rel="stylesheet" type="text/css" href="../../css/iconfont.css">
		<script type="text/javascript" src="../../framework/jquery-1.11.3.min.js"></script>
		<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css">
		<script type="text/javascript" src="../../layui/layui.js"></script>
		<!-- 滚动条插件 -->
		<link rel="stylesheet" type="text/css" href="../../css/jquery.mCustomScrollbar.css">
		<script src="../../framework/jquery-ui-1.10.4.min.js"></script>
		<script src="../../framework/jquery.mousewheel.min.js"></script>
		<script src="../../framework/jquery.mCustomScrollbar.min.js"></script>
		<script src="../../framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
		<!-- 公共样式 结束 -->
	</head>

	<body>
		<div class="">
					<form id="addForm" class="layui-form" action="">
						<div class="layui-col-md6">
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">车牌号</label>
								<div class="layui-input-inline shortInput">
									<input type="text" name="carid" id="carid" required lay-verify="required" autocomplete="off" class="layui-input" disabled="disabled" style="background-color: #F2F2F2">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">车型</label>
								<div class="layui-input-inline shortInput">
									<input type="text" name="cartepy" id="cartepy" required lay-verify="required" autocomplete="off" class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">保养记录</label>
								<div class="layui-input-inline shortInput">
									<input type="text" name="maintenance" id="maintenance" required lay-verify="required" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">启用状态</label>
								<div class="layui-input-inline">
									<select id="isenable">
										<option value="0" selected = "selected">启用</option>
										<option value="1">不启用</option>
									</select> 
								</div>
							</div>
						</div>
						<div class="layui-col-md6">
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">使用状态</label>
								<div class="layui-input-inline">
									<select id="isedit">
										<option value="0" selected = "true">启用</option>
										<option value="1" >不启用</option>
									</select> 
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">购车时间</label>
								<div class="layui-input-inline shortInput">
									<input type="text" name="jointime" id="jointime" required lay-verify="required" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">年检时间</label>
								<div class="layui-input-inline shortInput">
									<input type="text" name="inspect" id="inspect" required lay-verify="required" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:100px;">基本详情</label>
								<div class="layui-input-inline shortInput">
									<input type="text" name="note" id="note" required lay-verify="required" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item layui-hide">
								<input type="button" lay-submit lay-filter="btn_update" id="btn_update" value="确认添加">
								<input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
							</div>
						</div>	
					</form>	
				</div>
	<script src="../../layui/layui.js"></script>
	<script src="../../js/Bookkeep.js"></script>
	<script src="framework/area.js"></script>
	<script src="framework/province.js"></script>
	<script src="../../js/application.js"></script>
	<script>
		layui.use(['table','jquery','form','layer'], function(){
		  var table = layui.table;
		  var $ = layui.jquery;
		  var form=layui.form;
		  var layer = layui.layer;
		  
		    //监听提交,添加事件
		    form.on('submit(btn_update)', function(data){
		      var field = data.field; //获取提交的字段
		      var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
					var carid=$("#carid").val().trim();
					var cartepy=$("#cartepy").val().trim();
			    	var maintenance=$("#maintenance").val();
					var isenable=$("#isenable").val();
					var isedit=$("#isedit").val();
					var jointime=$("#jointime").val();
					var note=$("#note").val();
					var inspect=$("#inspect").val();
					var obj = {
								"carid":carid,
								"cartepy":cartepy,
								"maintenance":maintenance,
								"jointime":jointime,	
								"note":note,		
								"inspect":inspect,
								"isenable":isenable,
								"isedit":isedit,
								};
					// var param ="?carid=" + carid + "&cartepy=" + cartepy + "&maintenance=" + maintenance + "&isenable=" +isenable + "&isedit=" +isedit + "&jointime=" +jointime
					//  +"&note=" + note + "&inspect=" + inspect;
				    // alert(param)
					$.ajax({
						url: urlapi+'car/modifycar',
						type:"POST",
						data: obj,
						dataType : "json",
						success:function(date){
							if(date.code == 0){
								layer.msg(date.msg,{icon:6}); 
							}else{
								layer.msg(date.msg,{icon:5});
							}
							setTimeout(function(){
								parent.layui.table.reload('LAY-app-content-list'); //重载表格
		     					parent.layer.close(index); //再执行关闭 
								parent.layui.table.reload('CarList'); //重载表格
							},1*1000)
						},
						error:function(date){
							layer.msg(date.msg,{icon:5});
						}
					})
		      	return false;
		    });
		});
	</script>
	<script>
	layui.use('laydate', function(){
	  var laydate = layui.laydate;
	  laydate.render({
	    elem: '#jointime' ,
	   //指定元素
	  });
	});
	</script>
	<script>
	layui.use('laydate', function(){
	  var laydate2 = layui.laydate;
	  laydate2.render({
	    elem: '#inspect' ,
	   //指定元素
	  });
	});
	</script>
	</body>

</html>
